import 'package:flutter/material.dart';

class AlbumPhotoPage extends StatelessWidget {
  const AlbumPhotoPage({
    Key key,
    this.itemCount,
    this.countPerRow = 4,
    this.itemBuilder,
    this.title = 'Photos',
  }) : super(key: key);

  final String title;
  final int itemCount;
  final int countPerRow;
  final IndexedWidgetBuilder itemBuilder;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(title),
      ),
      body: Container(
        child: itemCount <= 0 ? null : GridView.builder(
          padding: EdgeInsets.symmetric(
            horizontal: 16,
            vertical: 13,
          ),
          gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
            crossAxisCount: countPerRow,
            crossAxisSpacing: 14,
            mainAxisSpacing: 11,
            childAspectRatio: 1.0,
          ),
          itemCount: itemCount,
          itemBuilder: itemBuilder,
        ),
      ),
    );
  }
}
